package com.tenbent.product.center.role.bo;

import com.tenbent.product.base.bo.BizObject;
import com.tenbent.product.base.mybatis.annotations.TypeAlias;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 角色资源实体类
 *
 * @author Randy
 *
 *         Created by ThinkPad on 2017/9/12.
 */
@Entity
@Table(name = "pc_role_resource")
@TypeAlias("roleResource")
public class RoleResource extends BizObject {

	/** 角色ID */
	@Column(name = "role_id")
	private Integer roleId;

	/** 角色code */
	@Column(name = "role_code")
	private String roleCode;

	/** 资源ID */
	@Column(name = "resource_id")
	private Integer resourceId;

	public Integer getRoleId() {
		return roleId;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	public Integer getResourceId() {
		return resourceId;
	}

	public void setResourceId(Integer resourceId) {
		this.resourceId = resourceId;
	}

	public String getRoleCode() {
		return roleCode;
	}

	public void setRoleCode(String roleCode) {
		this.roleCode = roleCode;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		RoleResource that = (RoleResource) o;

		if (roleId != null ? !roleId.equals(that.roleId) : that.roleId != null)
			return false;
		if (roleCode != null ? !roleCode.equals(that.roleCode) : that.roleCode != null)
			return false;
		return resourceId != null ? resourceId.equals(that.resourceId) : that.resourceId == null;

	}

	@Override
	public int hashCode() {
		int result = roleId != null ? roleId.hashCode() : 0;
		result = 31 * result + (roleCode != null ? roleCode.hashCode() : 0);
		result = 31 * result + (resourceId != null ? resourceId.hashCode() : 0);
		return result;
	}

	@Override
	public String toString() {
		return "RoleResource{" + "roleId=" + roleId + ", roleCode='" + roleCode + '\'' + ", resourceId=" + resourceId
				+ '}';
	}
}
